package flyweight;

import java.util.HashMap;

public class WebsiteFactory {
    private HashMap<String, Website> pool = new HashMap<>();

    public Website getConcreteWebsite(String type) {
        System.out.println("构建" + type + "类型的网站。");
        if(!pool.containsKey(type)) {
            pool.put(type, new ConcreteWebsite(type));
        }
        return pool.get(type);
    }

    public int websiteSize() {
        return pool.size();
    }
}
